import 'package:flutter/material.dart';
import 'package:flutter_business_1803a/provide/provide_cart.dart';
import 'package:flutter_business_1803a/provide/provide_detail_info.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:provide/provide.dart';

class DetailsBottom extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // var goodsInfo = Provide.value<DetailsInfoProvide>(context).goodsInfo;
    // var goodsId = goodsInfo.goodsId;
    // var goodsName = goodsInfo.goodsName;
    // var count = 1;
    // var price = goodsInfo.minGroupPrice;
    // var images = goodsInfo.goodsImageUrl;

    return Container(
      width: ScreenUtil().setWidth(750),
      color: Colors.white,
      height: ScreenUtil().setHeight(80),
      child: Row(
        children: <Widget>[
          InkWell(
            onTap: () {},
            child: Container(
              width: ScreenUtil().setWidth(110),
              alignment: Alignment.center,
              child: Icon(
                Icons.shopping_cart,
                size: 35,
                color: Colors.red,
              ),
            ),
          ),
          InkWell(
            onTap: () async {
              await Provide.value<CartProvide>(context).save(
                  Provide.value<DetailsInfoProvide>(context).goodsInfo.goodsId,
                  Provide.value<DetailsInfoProvide>(context).goodsInfo.goodsName,
                  1,
                  Provide.value<DetailsInfoProvide>(context).goodsInfo.minGroupPrice,
                  Provide.value<DetailsInfoProvide>(context).goodsInfo.goodsImageUrl);
            },
            child: Container(
              alignment: Alignment.center,
              width: ScreenUtil().setWidth(320),
              height: ScreenUtil().setHeight(80),
              color: Colors.green,
              child: Text(
                '加入购物车',
                style: TextStyle(
                    color: Colors.white, fontSize: ScreenUtil().setSp(28)),
              ),
            ),
          ),
          InkWell(
            onTap: () async {
              await Provide.value<CartProvide>(context).remove();
            },
            child: Container(
              alignment: Alignment.center,
              width: ScreenUtil().setWidth(320),
              height: ScreenUtil().setHeight(80),
              color: Colors.red,
              child: Text(
                '马上购买',
                style: TextStyle(
                    color: Colors.white, fontSize: ScreenUtil().setSp(28)),
              ),
            ),
          )
        ],
      ),
    );
  }
}
